package com.xcc.cloud.stream.controller;

import com.xcc.cloud.stream.sink.MqMessageSink;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;

@Component
@EnableBinding(MqMessageSink.class)
public class ReceiveMessageListenerController {

    @Value("${server.port}")
    private String serverPort;

    @StreamListener(MqMessageSink.IN_PUT)
    public void input(Message<String>message) {
        System.out.println("input 消费者2号，接受："+message.getPayload()+"\t port:"+serverPort);
    }

    @StreamListener(MqMessageSink.IN_PUT1)
    public void input1(Message<String>message) {
        System.out.println("input1 消费者2号，接受："+message.getPayload()+"\t port:"+serverPort);
    }

    @StreamListener(MqMessageSink.IN_PUT2)
    public void input2(Message<String>message) {
        System.out.println("input2 消费者2号，接受："+message.getPayload()+"\t port:"+serverPort);
    }

}
